﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>商家操作</title>
    <link href="~/plugins/layui/css/layui.css" rel="stylesheet" />
</head>
<body style="margin-left:10px;margin-top:10px;">
    @using (Html.BeginForm("cpau", "ljsheng", new { gid = Request.QueryString["gid"] }, FormMethod.Post, new { @class = "layui-form layui-form-pane", enctype = "multipart/form-data" }))
    {
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">商家分类</label>
            <div class="layui-input-inline">
                <select name="flgid">
                    @foreach (var item in Model)
                    {
                        if (!string.IsNullOrEmpty(Request.QueryString["flgid"]) && @item.gid == Guid.Parse(Request.QueryString["flgid"]))
                        {
                            <option value="@item.gid" selected="">@item.name</option>
                        }
                        else
                        {
                            <option value="@item.gid">@item.name</option>
                        }
                    }
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">套餐名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" lay-verify="account" placeholder="请输入" autocomplete="off" class="layui-input" value="@ViewBag.name">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">介绍图片</label>
            <div class="layui-input-inline">
                <input type="file" name="picture" id="picture" class="layui-upload-file" lay-ext="jpg|png|gif">
            </div>
            <div class="layui-form-mid layui-word-aux layui-hide"><input type="text" name="pictureurl" placeholder="图片上传的成功的名称" autocomplete="off" class="layui-input"></div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">有效天数</label>
                <div class="layui-input-inline" style="width: 80px;">
                    <input type="text" name="xfx" lay-verify="num" placeholder="整数" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d]/g,'');" value="@ViewBag.xfx">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">机器码位数</label>
                <div class="layui-input-inline" style="width: 80px;">
                    <input type="text" name="xfd" lay-verify="num" placeholder="0通用" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d]/g,'');" value="@ViewBag.xfd">
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <div class="layui-inline">
                <label class="layui-form-label layui-hide">原价</label>
                <div class="layui-input-inline layui-hide" style="width: 80px;">
                    <input type="text" name="yjrmb" lay-verify="num" placeholder="原价" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d]/g,'');" value="0">
                </div>
                <label class="layui-form-label">售价</label>
                <div class="layui-input-inline" style="width: 80px;">
                    <input type="text" name="payrmb" lay-verify="num" placeholder="售价" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d]/g,'');" value="0">
                </div>
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">商家特色</label>
            <div class="layui-input-block">
                <input type="text" name="tese" placeholder="请输入特色,多个请用输入法英文状态的空格分开" autocomplete="off" class="layui-input" value="@ViewBag.tese">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">最惠待遇</label>
            <div class="layui-input-inline">
                <input type="text" name="zhekou" placeholder="最惠待遇说明" autocomplete="off" class="layui-input" value="@ViewBag.zhekou">
            </div>
            <div class="layui-form-mid layui-word-aux">描述最惠信息,不要超过8个字</div>
        </div>
        <div class="layui-form-item layui-hide">
            <label class="layui-form-label">返利比例</label>
            <div class="layui-input-inline">
                <input type="text" name="fl" placeholder="单位是%" lay-verify="num" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d.]/g,'');" value="@ViewBag.fl">
            </div>
            <div class="layui-form-mid layui-word-aux">例:填写3 消费100元就是返3元</div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">联系方式</label>
            <div class="layui-input-block">
                <input type="text" name="lxfs" placeholder="商家电话" autocomplete="off" class="layui-input" value="@ViewBag.lxfs">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")" pane="">
            <label class="layui-form-label">支付类型</label>
            <div class="layui-input-block">
                <input type="radio" name="grade" value="合作型" title="合作型" @(ViewBag.grade != "商务型" ? "checked=\"\"" : "")>
                <input type="radio" name="grade" value="商务型" title="商务型" @(ViewBag.grade == "商务型" ? "checked=\"\"" : "")>
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">登录帐号</label>
            <div class="layui-input-inline">
                <input type="text" id="account" name="account" lay-verify="tjrsj" placeholder="请输入登录的手机号" autocomplete="off" class="layui-input" @(string.IsNullOrEmpty(Request.QueryString["gid"]) ? "" : "disabled") onkeyup="value=value.replace(/[^\d]/g,'');" value="18888888888">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">登录密码</label>
            <div class="layui-input-inline">
                <input type="password" name="pwd" lay-verify="pass" placeholder="请输入密码" autocomplete="off" class="layui-input" value="123456">
            </div>
            <div class="layui-form-mid layui-word-aux">密码6-20位</div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">请选择省市区</label>
            <div class="layui-input-inline">
                <select name="province" id="Province" lay-ignore>
                    <option></option>
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="city" id="City" lay-ignore>
                    <option></option>
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="area" id="Area" lay-ignore>
                    <option></option>
                </select>
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">具体地址</label>
            <div class="layui-input-block">
                <input type="text" name="address" placeholder="路段,门牌号,楼层" autocomplete="off" class="layui-input" value="@ViewBag.address">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">推荐人</label>
            <div class="layui-input-inline">
                <input type="text" id="tjr" name="tjr" placeholder="推荐人的手机号码" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d]/g,'');" value="@ViewBag.tjr" @(string.IsNullOrEmpty(Request.QueryString["gid"]) ? "" : "disabled=\"\"")>
            </div>
            <div class="layui-form-mid layui-word-aux">@ViewBag.uname</div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">微信ID</label>
            <div class="layui-input-block">
                <input type="text" name="openid" placeholder="微信标识" autocomplete="off" class="layui-input" value="@ViewBag.openid">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">开户行</label>
            <div class="layui-input-inline">
                <input type="text" name="khh" placeholder="请输入开户行" autocomplete="off" class="layui-input" value="@ViewBag.khh">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">开户人</label>
            <div class="layui-input-inline">
                <input type="text" name="khm" placeholder="请输入开户人" autocomplete="off" class="layui-input" value="@ViewBag.khm">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">银行卡号</label>
            <div class="layui-input-inline">
                <input type="text" name="kahao" placeholder="请输入银行卡号" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d]/g,'');" value="@ViewBag.kahao">
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")" pane="">
            <label class="layui-form-label">用户权限</label>
            <div class="layui-input-block">
                <input type="radio" name="qx" value="正常" title="正常" @(ViewBag.qx == "正常" ? "checked=\"\"" : "")>
                <input type="radio" name="qx" value="审核中" title="审核中" @(ViewBag.qx == "审核中" ? "checked=\"\"" : "")>
                <input type="radio" name="qx" value="锁定" title="锁定" @(ViewBag.qx == "锁定" ? "checked=\"\"" : "")>
            </div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">商家简介</label>
            <div class="layui-input-block">
                <textarea type="text" id="explain" name="explain" autocomplete="off" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">套餐介绍</label>
            <div class="layui-input-block">
                <textarea type="text" id="introduce" name="introduce" autocomplete="off" class="layui-textarea"></textarea>
            </div>
            <div id="htm" class="layui-hide">@Html.Raw(ViewBag.introduce)</div>
        </div>
        <div class="layui-form-item @(Request.QueryString["lx"]=="3"?"layui-hide":"")">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
                <input type="text" name="sort" lay-verify="num" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/[^\d]/g,'');" value="@ViewBag.sort">
            </div>
            <div class="layui-form-mid layui-word-aux">数字越大显示越前面(设置为 0 时,商家状态为客满)</div>
        </div>
        <div class="layui-form-item" pane="">
            <label class="layui-form-label">是否显示</label><input name="lx" type="text" class="layui-hide" value="@Request.QueryString["lx"]">
            <div class="layui-input-block">
                <input type="radio" name="show" value="显示" title="显示" @(ViewBag.show == 1 ? "checked=\"\"" : "")>
                <input type="radio" name="show" value="不显示" title="不显示" @(ViewBag.show == 2 ? "checked=\"\"" : "")>
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-submit="" onclick="return ck();">提交</button>
        </div>
    }
    <script src="~/js/jquery.js"></script>
    <script src="~/plugins/layui/layui.js"></script>
    <script src="~/js/pca.js" charset="gb2312"></script>
    <script>
        setup();
        if ("@ViewBag.province".length > 0) {
            preselect("@ViewBag.province");
            document.getElementById("City").value = "@ViewBag.city";
            change(2);
            document.getElementById("Area").value = "@ViewBag.area";
        }
        $("#introduce").html($("#htm").html());
        $("#explain").text("@ViewBag.explain");
        layui.use(['form', 'layedit'], function () {
            var layedit = layui.layedit;
            //构建一个默认的编辑器
            layedit.set({
                uploadImage: {
                    url: '/ljsheng/bjqupload' //接口url
                    , type: 'post' //默认post
                }
            });
            var introduce = layedit.build('introduce');
        });
        layui.use('upload', function () {
            layui.upload({
                url: '/ljsheng/upload?path=/uploadfiles/shop/' //上传接口
                , before: function (input) {
                    layer.tips('图片上传中...', '#picture');
                }
                , success: function (res) { //上传成功后的回调
                    document.getElementsByName("pictureurl")[0].value = res.data;
                    layer.tips('图片上传成功', '#picture');
                }
            });
        });
        function ck() {

            return true;
        }
    </script>
</body>
</html>
